<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head >
    <meta charset="UTF-8">
    <title>发布</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/css/bootstrap-theme.min.css}">
    <link rel="stylesheet" th:href="@{/css/publish.css}">
    <link rel="stylesheet" th:href="@{/css/index.css}">
    <link rel="stylesheet" th:href="@{/css/editormd.min.css}">
    <script th:src="@{/js/jquery-3.3.1.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <script th:src="@{/js/community.js}"></script>
    <script th:src="@{/js/editormd.min.js}"></script>
</head>
<body>
<div th:insert="~{navigation :: header}"></div>
<div class="container-fluid main">
    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12" style="">

            <h2><span class="glyphicon glyphicon-plus" aria-hidden="true"></span>发起</h2>
            <hr>
            <form method="post" action="/publish">
                <input type="hidden" name="id" th:value="${id}">
                <div class="form-group">
                    <label for="title">问题标题（简单扼要）：</label>
                    <input type="text" class="form-control" th:value="${title}"  id="title" name="title" placeholder="问题标题...">
                </div>
                <div class="form-group" id="question-editor">
                    <label for="description">问题（必填请参考右侧）：</label>
                    <textarea name="description" id="description" th:text="${description}" style="display: none" cols="30" rows="10" class="form-control"></textarea>
                </div>
                <script type="text/javascript">
                    $(function() {
                        var editor = editormd("question-editor", {
                             width  : "100%",
                             height : 350,
                             delay : 0,
                             watch : false,
                             placeholder : "请输入问题措述",
                             imageUpload    : true,
                             imageFormats   : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
                             imageUploadURL : "/file/upload",
                             path   : "/js/lib/"
                        });
                    });
                </script>
                <div class="form-group">
                    <label for="tag">添加标签：</label>
                    <input type="text" class="form-control"  id="tag" th:value="${tag}" name="tag" placeholder="请输入标签以英文逗号','号分割" onclick="showTag()">
                    <div id="select-tag"  class="tab-tag">
                        <!-- Nav tabs -->
                        <ul class="nav nav-tabs" role="tablist">
                            <li role="presentation" th:each="thisTag,thisTagStat :${tags}" th:class="${thisTagStat.first ? 'active' : ''}">
                                <a th:href="${'#'+thisTag.categoryName}" aria-controls="home" role="tab" data-toggle="tab" th:text="${thisTag.categoryName}"></a>
                            </li>
                        </ul>
                        <!-- Tab panes -->
                        <div class="tab-content">
                            <div role="tabpanel" class="tab-pane " th:id="${thisTag.categoryName}"  th:each="thisTag :${tags}" th:class="${thisTagStat.first ? 'active tab-pane' : 'tab-pane'}">
                              <span>
                                    <span class="label label-info tag_lable"  th:each="selectTag :${thisTag.tags}">
                                    <span class="glyphicon glyphicon-tags glyphicon_tag_lable"  onclick="selectTag(this)" th:data-tag="${selectTag}" th:text="${'  '+selectTag}"></span>
                                </span>
                              </span>
                            </div>
                        </div>

                    </div>
                </div>
                <div class="alert alert-danger alert_span" th:if="${error != null}" th:text="${error}"></div>
                <span th:if="${error == null}" ></span>
                <button type="submit" class="btn btn-success btn-publish">发布</button>
            </form>
        </div>
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12" style="">
            <h3>发起问题指南</h3>
            .问题标题:请用精简的语言描述您发布的问题，不超过25字<br><br>
            .问题补充: 详细补充您的问题内容， 井确保问题描述清晰直观，并提供一些相关的资料<br><br>
            .选择标签:选择一个或者多个合适的标签，用逗号阳开，怀超过10个字
            <br><br>
            .关于积分: 发起一个问题会消耗您20个积分，每多一个回复你将获得5个积分的奖励,为了您的利益，在发起问题的时候希望能够更好的描述您的问题以及多使用站内搜索功能
            <div th:insert="~{side :: side}"></div>
        </div>
    </div>
</div>
<div th:insert="~{footer :: foot}"></div>
</body>
</html>